﻿
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

#include "IDock.h"
#include "IWidget.h"

#include "UIPlatform.h"

namespace gcmp
{
    class IUiDocument;
    class IUiView;
    class IDocument;
}

namespace Sample
{
    /// \brief 资源管理器构造所需数据
    struct UIPLATFORM_EXPORT ModelViewDlgInput
    {
        virtual ~ModelViewDlgInput() {};
        ModelViewDlgInput()
        {
            UIDoc = nullptr;

            Area = gcmp::DockArea::Left;
            Orientation = gcmp::DockOrientation::Vertical;

            ModelViewDlgName = L"";
            ModelViewDlgTitle = L"";

            /*/ TODO：相关命令后续实现 */
            // 是否显示构件编辑的右键菜单命令
            bool IsShowFamilyManagementMenuItem = false;
        }

        gcmp::IUiDocument* UIDoc;

        gcmp::DockArea Area;
        gcmp::DockOrientation Orientation;

        std::wstring ModelViewDlgName;
        std::wstring ModelViewDlgTitle;

        // 是否在族管理器中显示Family的管理命令菜单项
        bool IsShowFamilyManagementMenuItem;
    };

    /// \brief 资源管理器
    ///
    /// 资源管理器包含了视图管理、族管理
    /// \see IDock
    class UIPLATFORM_EXPORT IModelViewDlg : public gcmp::IWidget
    {
    public:
        /// \brief 析构器
        virtual ~IModelViewDlg();

        /// \brief 根据名字获取资源管理器
        /// \param const std::wstring & 资源管理器的名字
        /// \return IModelViewDlg* 资源管理器
        static IModelViewDlg* Get(const std::wstring& name);

        /// \brief 创建一个资源管理器,除文档初始化等,不应主动调用
        /// \param const ModelViewDlgInput& 资源管理器构造所需数据
        /// \return IModelViewDlg* 资源管理器
        static IModelViewDlg* Create(const ModelViewDlgInput& input);

        /// \brief 初始化、刷新资源管理器,除文档初始化等,不应主动调用
        /// \param IUiDocument* 用于初始化、刷新资源管理器的Ui文档
        virtual void Init(gcmp::IUiDocument* pUIDoc) = 0;
    };
}

